package cn.tedu.ivos.approval.controller;

import cn.tedu.ivos.approval.pojo.dto.AuditQueryParam;
import cn.tedu.ivos.approval.pojo.dto.AuditSaveParam;
import cn.tedu.ivos.approval.pojo.vo.AuditVO;
import cn.tedu.ivos.approval.service.AuditService;
import cn.tedu.ivos.base.handler.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags="审批单模块")
@RestController
@RequestMapping("/v1/audit")
public class AuditController {
    @Autowired
    private AuditService auditService;

    @ApiOperation("查询审批单")
    @ApiImplicitParam(name = "auditQueryParam",value = "查询参数",required = true)
    @GetMapping("/select")
    public JsonResult selectAudits(AuditQueryParam auditQueryParam){
        List<AuditVO> auditVOList = auditService.selectAudits(auditQueryParam);
        return JsonResult.ok(auditVOList);
    }
    @PutMapping ("/update")
    public JsonResult updateAudit(AuditSaveParam auditSaveParam){
        System.out.println("auditSaveParam="+auditSaveParam);
        auditService.updateAudit(auditSaveParam);
        return JsonResult.ok();
    }

}
